﻿using RoomyDungeonGenerator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
	class Program
	{
		/// <summary>This will generate a map and display it on the console, each time you press Enter.
		/// <para>
		/// Pressing Spacebar will re-generate the same map (by using the same seed). This is useful for debugging.
		/// </para>
		/// Any other key will exit. Tweak the optional parameters for the Generate call and see what they do.</summary>
		static void Main(string[] args)
		{
			Random r = new Random();
			int seed = r.Next();
			ConsoleKey pressed = ConsoleKey.Enter;
			int ctr = 0;
			Console.SetWindowSize(210, 50);
			do
			{
				Console.Clear();
				if (pressed == ConsoleKey.Enter)
					seed = r.Next();
				Map map = MapGenerator.Generate(seed, minRows: 35, maxRows: 50, minCols: 35, maxCols: 50, minRoomCount: 42, maxRoomCount: 45, roomConnectionDistance: 4);
				Console.WriteLine(map.Tiles.ToDisplayString());
				Console.WriteLine();
				Console.WriteLine("Map no. {0}, seed: {1}", ++ctr, seed);
				Console.WriteLine("Width: {0}, height: {1} | {2} rooms", map.Tiles.GetLength(0), map.Tiles.GetLength(1), map.Rooms.Count);
				Console.WriteLine("[Enter]: new map");
				Console.WriteLine("[Spacebar]: re-generate same map");
				Console.WriteLine("[Any other key]: exit");
				pressed = Console.ReadKey().Key;
			} while (pressed == ConsoleKey.Enter || pressed == ConsoleKey.Spacebar);
		}
	}
}
